<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
<div class="inout">
    <p>整数一</p>
    <input type="text" class="kl">
    <p>整数二</p>
    <input type="text" class="li1">
</div>
<button onclick="a('plus')">相加</button>
<button onclick="a('d')">相减</button>
<button onclick="a('i')">相乘</button>
<button onclick="a('u')">相除</button>
<p>结果</p>
<input type="text" class="li2">
<script>
    function a(e) {
        var kl = document.querySelector('.kl').value;
        var li1 = document.querySelector('.li1').value;
        var li2 = document.querySelector('.li2');
        switch(e){
            case "plus":
                    li2.value =Number(kl)+Number(li1);
                break;
            case "d":
                li2.value =Number(kl)-Number(li1);
                break;
            case "i":
                li2.value =Number(kl)*Number(li1);
                break;
            case "u":
                li2.value =Number(kl)/Number(li1);
                break;



        }

    }
</script>
</body>
</html>